#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    ui->label->setText("感谢导员，我出去玩了");
}

void Widget::on_pushButton_2_clicked()
{
    int width = this->geometry().width();
    //获取窗口宽度
    int height = this->geometry().height();
    //获取窗口高度
    int x = rand() % width;
    int y = rand() % height;
    //保证按钮在窗口内

    //这里用的move
    ui->pushButton_2->move(x, y);

}
